package lab4;

import java.util.Scanner;

public class ZigZag {

	int n, counter;;
	int[][] a;
	
	public static void main(String[] args) {
		ZigZag ziggy = new ZigZag();
		ziggy.display();
	}

	public ZigZag() {
		super();
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		counter=0;
		a=new int[n][n];
		sc.close();
		fillA();
	}
	
	private void fillA()
	{
		for (int i = 1; i < n; i++ )
		{
			for (int j = 0; j <=i-1; j++)
			{
				a[i][j]=counter;
				counter++;
			}
		}
	}
	
	
	private void display()
	{
		for (int i = 0; i <n; i++)
		{
			for (int j = 0; i <n; j++)
			{
				System.out.print(a[i][j]+" ");
			}
			System.out.println();
		}
	}

}
